<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: WillPaginate::LinkRenderer</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">WillPaginate::LinkRenderer</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/will_paginate/lib/will_paginate/view_helpers_rb.html">
                vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This class does the heavy lifting of actually building the pagination
links. It is used by the <tt>will_paginate</tt> helper internally.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000034">html_attributes</a>&nbsp;&nbsp;
      <a href="#M000031">new</a>&nbsp;&nbsp;
      <a href="#M000038">page_link</a>&nbsp;&nbsp;
      <a href="#M000037">page_link_or_span</a>&nbsp;&nbsp;
      <a href="#M000039">page_span</a>&nbsp;&nbsp;
      <a href="#M000032">prepare</a>&nbsp;&nbsp;
      <a href="#M000033">to_html</a>&nbsp;&nbsp;
      <a href="#M000040">url_for</a>&nbsp;&nbsp;
      <a href="#M000036">visible_page_numbers</a>&nbsp;&nbsp;
      <a href="#M000035">windowed_links</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">gap_marker</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
The gap in page links is represented by:

<pre>
  &lt;span class=&quot;gap&quot;&gt;&amp;hellip;&lt;/span&gt;
</pre>
</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000031" class="method-detail">
        <a name="M000031"></a>

        <div class="method-heading">
          <a href="#M000031" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000031-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 210</span>
210:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
211:       <span class="ruby-ivar">@gap_marker</span> = <span class="ruby-value str">'&lt;span class=&quot;gap&quot;&gt;&amp;hellip;&lt;/span&gt;'</span>
212:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000034" class="method-detail">
        <a name="M000034"></a>

        <div class="method-heading">
          <a href="#M000034" class="method-signature">
          <span class="method-name">html_attributes</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the subset of <tt>options</tt> this instance was initialized with
that represent HTML attributes for the container element of pagination
links.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000034-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 242</span>
242:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">html_attributes</span>
243:       <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@html_attributes</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@html_attributes</span>
244:       <span class="ruby-ivar">@html_attributes</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">except</span> <span class="ruby-operator">*</span>(<span class="ruby-constant">WillPaginate</span><span class="ruby-operator">::</span><span class="ruby-constant">ViewHelpers</span>.<span class="ruby-identifier">pagination_options</span>.<span class="ruby-identifier">keys</span> <span class="ruby-operator">-</span> [<span class="ruby-identifier">:class</span>])
245:       <span class="ruby-comment cmt"># pagination of Post models will have the ID of &quot;posts_pagination&quot;</span>
246:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:container</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:id</span>] <span class="ruby-operator">===</span> <span class="ruby-keyword kw">true</span>
247:         <span class="ruby-ivar">@html_attributes</span>[<span class="ruby-identifier">:id</span>] = <span class="ruby-ivar">@collection</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>.<span class="ruby-identifier">pluralize</span> <span class="ruby-operator">+</span> <span class="ruby-value str">'_pagination'</span>
248:       <span class="ruby-keyword kw">end</span>
249:       <span class="ruby-ivar">@html_attributes</span>
250:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000032" class="method-detail">
        <a name="M000032"></a>

        <div class="method-heading">
          <a href="#M000032" class="method-signature">
          <span class="method-name">prepare</span><span class="method-args">(collection, options, template)</span>
          </a>
        </div>
      
        <div class="method-description">
          <ul>
<li><tt>collection</tt> is a <a
href="Collection.html">WillPaginate::Collection</a> instance or any other
object that conforms to that API

</li>
<li><tt>options</tt> are forwarded from <tt>will_paginate</tt> view helper

</li>
<li><tt>template</tt> is the reference to the template being rendered

</li>
</ul>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000032-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 218</span>
218:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">prepare</span>(<span class="ruby-identifier">collection</span>, <span class="ruby-identifier">options</span>, <span class="ruby-identifier">template</span>)
219:       <span class="ruby-ivar">@collection</span> = <span class="ruby-identifier">collection</span>
220:       <span class="ruby-ivar">@options</span>    = <span class="ruby-identifier">options</span>
221:       <span class="ruby-ivar">@template</span>   = <span class="ruby-identifier">template</span>
222: 
223:       <span class="ruby-comment cmt"># reset values in case we're re-using this instance</span>
224:       <span class="ruby-ivar">@total_pages</span> = <span class="ruby-ivar">@param_name</span> = <span class="ruby-ivar">@url_string</span> = <span class="ruby-keyword kw">nil</span>
225:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000033" class="method-detail">
        <a name="M000033"></a>

        <div class="method-heading">
          <a href="#M000033" class="method-signature">
          <span class="method-name">to_html</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Process it! This method returns the complete HTML string which contains
pagination links. Feel free to subclass <a
href="LinkRenderer.html">LinkRenderer</a> and change this method as you see
fit.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000033-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 230</span>
230:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_html</span>
231:       <span class="ruby-identifier">links</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:page_links</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">windowed_links</span> <span class="ruby-operator">:</span> []
232:       <span class="ruby-comment cmt"># previous/next buttons</span>
233:       <span class="ruby-identifier">links</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">page_link_or_span</span>(<span class="ruby-ivar">@collection</span>.<span class="ruby-identifier">previous_page</span>, <span class="ruby-value str">'disabled prev_page'</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:previous_label</span>])
234:       <span class="ruby-identifier">links</span>.<span class="ruby-identifier">push</span>    <span class="ruby-identifier">page_link_or_span</span>(<span class="ruby-ivar">@collection</span>.<span class="ruby-identifier">next_page</span>,     <span class="ruby-value str">'disabled next_page'</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:next_label</span>])
235:       
236:       <span class="ruby-identifier">html</span> = <span class="ruby-identifier">links</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:separator</span>])
237:       <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:container</span>] <span class="ruby-operator">?</span> <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">content_tag</span>(<span class="ruby-identifier">:div</span>, <span class="ruby-identifier">html</span>, <span class="ruby-identifier">html_attributes</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">html</span>
238:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000038" class="method-detail">
        <a name="M000038"></a>

        <div class="method-heading">
          <a href="#M000038" class="method-signature">
          <span class="method-name">page_link</span><span class="method-args">(page, text, attributes = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000038-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 305</span>
305:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">page_link</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">attributes</span> = {})
306:       <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">link_to</span> <span class="ruby-identifier">text</span>, <span class="ruby-identifier">url_for</span>(<span class="ruby-identifier">page</span>), <span class="ruby-identifier">attributes</span>
307:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000037" class="method-detail">
        <a name="M000037"></a>

        <div class="method-heading">
          <a href="#M000037" class="method-signature">
          <span class="method-name">page_link_or_span</span><span class="method-args">(page, span_class, text = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000037-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 294</span>
294:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">page_link_or_span</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">span_class</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword kw">nil</span>)
295:       <span class="ruby-identifier">text</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">page</span>.<span class="ruby-identifier">to_s</span>
296:       
297:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">page</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">current_page</span>
298:         <span class="ruby-identifier">classnames</span> = <span class="ruby-identifier">span_class</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">span_class</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">' '</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">span_class</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value">2</span>).<span class="ruby-identifier">last</span>
299:         <span class="ruby-identifier">page_link</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">:rel</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rel_value</span>(<span class="ruby-identifier">page</span>), <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">classnames</span>
300:       <span class="ruby-keyword kw">else</span>
301:         <span class="ruby-identifier">page_span</span> <span class="ruby-identifier">page</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">span_class</span>
302:       <span class="ruby-keyword kw">end</span>
303:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000039" class="method-detail">
        <a name="M000039"></a>

        <div class="method-heading">
          <a href="#M000039" class="method-signature">
          <span class="method-name">page_span</span><span class="method-args">(page, text, attributes = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000039-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 309</span>
309:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">page_span</span>(<span class="ruby-identifier">page</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">attributes</span> = {})
310:       <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">content_tag</span> <span class="ruby-identifier">:span</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">attributes</span>
311:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000040" class="method-detail">
        <a name="M000040"></a>

        <div class="method-heading">
          <a href="#M000040" class="method-signature">
          <span class="method-name">url_for</span><span class="method-args">(page)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns URL params for <tt><a
href="LinkRenderer.html#M000037">page_link_or_span</a></tt>, taking the
current GET params and <tt>:params</tt> option into account.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000040-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 315</span>
315:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">url_for</span>(<span class="ruby-identifier">page</span>)
316:       <span class="ruby-identifier">page_one</span> = <span class="ruby-identifier">page</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
317:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@url_string</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">page_one</span>
318:         <span class="ruby-ivar">@url_params</span> = {}
319:         <span class="ruby-comment cmt"># page links should preserve GET parameters</span>
320:         <span class="ruby-identifier">stringified_merge</span> <span class="ruby-ivar">@url_params</span>, <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">params</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">get?</span>
321:         <span class="ruby-identifier">stringified_merge</span> <span class="ruby-ivar">@url_params</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:params</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:params</span>]
322:         
323:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">complex</span> = <span class="ruby-identifier">param_name</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp re">/[^\w-]/</span>)
324:           <span class="ruby-identifier">page_param</span> = (<span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">CGIMethods</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">CGIMethods</span> <span class="ruby-operator">:</span> <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">AbstractRequest</span>).
325:             <span class="ruby-identifier">parse_query_parameters</span>(<span class="ruby-node">&quot;#{param_name}=#{page}&quot;</span>)
326:           
327:           <span class="ruby-identifier">stringified_merge</span> <span class="ruby-ivar">@url_params</span>, <span class="ruby-identifier">page_param</span>
328:         <span class="ruby-keyword kw">else</span>
329:           <span class="ruby-ivar">@url_params</span>[<span class="ruby-identifier">param_name</span>] = <span class="ruby-identifier">page_one</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">2</span>
330:         <span class="ruby-keyword kw">end</span>
331: 
332:         <span class="ruby-identifier">url</span> = <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">url_for</span>(<span class="ruby-ivar">@url_params</span>)
333:         <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">url</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">page_one</span>
334:         
335:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">complex</span>
336:           <span class="ruby-ivar">@url_string</span> = <span class="ruby-identifier">url</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-node">%r!((?:\?|&amp;amp;)#{CGI.escape param_name}=)#{page}!</span>, <span class="ruby-value str">'\1@'</span>)
337:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">url</span>
338:         <span class="ruby-keyword kw">else</span>
339:           <span class="ruby-ivar">@url_string</span> = <span class="ruby-identifier">url</span>
340:           <span class="ruby-ivar">@url_params</span>[<span class="ruby-identifier">param_name</span>] = <span class="ruby-value">3</span>
341:           <span class="ruby-ivar">@template</span>.<span class="ruby-identifier">url_for</span>(<span class="ruby-ivar">@url_params</span>).<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>).<span class="ruby-identifier">each_with_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
342:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">char</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'3'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">url</span>[<span class="ruby-identifier">i</span>, <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'2'</span>
343:               <span class="ruby-ivar">@url_string</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value str">'@'</span>
344:               <span class="ruby-keyword kw">break</span>
345:             <span class="ruby-keyword kw">end</span>
346:           <span class="ruby-keyword kw">end</span>
347:         <span class="ruby-keyword kw">end</span>
348:       <span class="ruby-keyword kw">end</span>
349:       <span class="ruby-comment cmt"># finally!</span>
350:       <span class="ruby-ivar">@url_string</span>.<span class="ruby-identifier">sub</span> <span class="ruby-value str">'@'</span>, <span class="ruby-identifier">page</span>.<span class="ruby-identifier">to_s</span>
351:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="#M000036" class="method-signature">
          <span class="method-name">visible_page_numbers</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Calculates visible page numbers using the <tt>:inner_window</tt> and
<tt>:outer_window</tt> options.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000036-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 269</span>
269:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">visible_page_numbers</span>
270:       <span class="ruby-identifier">inner_window</span>, <span class="ruby-identifier">outer_window</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:inner_window</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:outer_window</span>].<span class="ruby-identifier">to_i</span>
271:       <span class="ruby-identifier">window_from</span> = <span class="ruby-identifier">current_page</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">inner_window</span>
272:       <span class="ruby-identifier">window_to</span> = <span class="ruby-identifier">current_page</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">inner_window</span>
273:       
274:       <span class="ruby-comment cmt"># adjust lower or upper limit if other is out of bounds</span>
275:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">window_to</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">total_pages</span>
276:         <span class="ruby-identifier">window_from</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">window_to</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">total_pages</span>
277:         <span class="ruby-identifier">window_to</span> = <span class="ruby-identifier">total_pages</span>
278:       <span class="ruby-keyword kw">end</span>
279:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">window_from</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
280:         <span class="ruby-identifier">window_to</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">window_from</span>
281:         <span class="ruby-identifier">window_from</span> = <span class="ruby-value">1</span>
282:         <span class="ruby-identifier">window_to</span> = <span class="ruby-identifier">total_pages</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">window_to</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">total_pages</span>
283:       <span class="ruby-keyword kw">end</span>
284:       
285:       <span class="ruby-identifier">visible</span>   = (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">total_pages</span>).<span class="ruby-identifier">to_a</span>
286:       <span class="ruby-identifier">left_gap</span>  = (<span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">outer_window</span>)<span class="ruby-operator">...</span><span class="ruby-identifier">window_from</span>
287:       <span class="ruby-identifier">right_gap</span> = (<span class="ruby-identifier">window_to</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>)<span class="ruby-operator">...</span>(<span class="ruby-identifier">total_pages</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">outer_window</span>)
288:       <span class="ruby-identifier">visible</span>  <span class="ruby-operator">-=</span> <span class="ruby-identifier">left_gap</span>.<span class="ruby-identifier">to_a</span>  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">left_gap</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">left_gap</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
289:       <span class="ruby-identifier">visible</span>  <span class="ruby-operator">-=</span> <span class="ruby-identifier">right_gap</span>.<span class="ruby-identifier">to_a</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">right_gap</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">right_gap</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span>
290: 
291:       <span class="ruby-identifier">visible</span>
292:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000035" class="method-detail">
        <a name="M000035"></a>

        <div class="method-heading">
          <a href="#M000035" class="method-signature">
          <span class="method-name">windowed_links</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Collects link items for visible page numbers.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000035-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb, line 255</span>
255:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">windowed_links</span>
256:       <span class="ruby-identifier">prev</span> = <span class="ruby-keyword kw">nil</span>
257: 
258:       <span class="ruby-identifier">visible_page_numbers</span>.<span class="ruby-identifier">inject</span> [] <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">links</span>, <span class="ruby-identifier">n</span><span class="ruby-operator">|</span>
259:         <span class="ruby-comment cmt"># detect gaps:</span>
260:         <span class="ruby-identifier">links</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">gap_marker</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">prev</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">prev</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
261:         <span class="ruby-identifier">links</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">page_link_or_span</span>(<span class="ruby-identifier">n</span>, <span class="ruby-value str">'current'</span>)
262:         <span class="ruby-identifier">prev</span> = <span class="ruby-identifier">n</span>
263:         <span class="ruby-identifier">links</span>
264:       <span class="ruby-keyword kw">end</span>
265:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>